﻿#define  _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>
#include<stdlib.h>

void menu()
{
	printf("****************\n");
	printf("**** 1.play ****\n");
	printf("**** 0.exit ****\n");
	printf("****************\n");
}
void game()
{
	int r = rand() % 100 + 1;
	int guess = 0;
	while (1)
	{
		printf("请猜数字:");
		scanf("%d", &guess);
		if (guess > r)
		{
			printf("T_T不对哦，猜大了\n");
		}
		else if (guess < r)
		{
			printf("≥﹏≤猜小了，再来\n");
		}
		else
		{
			printf("(*'▽'*)猜对了，你真是个冰雪聪明的人类,数字是%d\n", r);
			break;
		}
	}
}
int main() 
{
	int input = 0;
	do
	{
		menu();
		printf("请输入");
		scanf("%d", &input);
		switch (input)
		{
		case 1:
			game();
			break;
		case 0:
			printf("游戏结束，退出游戏");
			break;
		default:
			printf("选择错误，你这个麻瓜←_←\n");
			break;
		}
	} while (input);
	

	return 0;
}

